<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>边补打卡日历查询</title>
  <link rel="stylesheet" href="../../../yl/style.css" />
  <script src="./js/vue.js"></script>
  <script src="../../../utils/utils.js"></script>
  <script src="../../../config/config.js"></script>
  <script src="../../../utils/mixins.js"></script>
  <!-- <script src="../../../yl/vue.js"></script> -->
  <!-- <script src="../../../yl/index.js"></script> -->
  <script src="../../../yl/jquery.min.js"></script>
  <script src="../../../utils/jquery.cookie.js"></script>
  <script src="../../../api/request.js"></script>
  <script src="./js/rili.js" defer></script>
  <style>
    body {
      font-family: 'Arial', sans-serif;
      background-color: #f5f5f5;
      margin: 0;
      padding: 20px;
      height: calc(100vh - 40px);
    }

    .calendar-container {
      /* max-width: 800px; */
      width: calc(100vw - 40px);
      height: calc(100% - 222px);
      margin: 0 auto;
      background: white;
      border-radius: 10px;
      box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    .calendar-header {
      flex-shrink: 0;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 20px;
      background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
      color: white;
    }

    .calendar-header h2 {
      margin: 0;
      font-size: 1.5rem;
    }

    .calendar-header button {
      background: rgba(255, 255, 255, 0.2);
      border: none;
      color: white;
      padding: 8px 16px;
      border-radius: 4px;
      cursor: pointer;
      font-weight: bold;
      transition: background 0.3s;
    }

    .calendar-header button:hover {
      background: rgba(255, 255, 255, 0.3);
    }

    .calendar-weekdays {
      flex-shrink: 0;
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      background: #f0f0f0;
      font-weight: bold;
      text-align: center;
      padding: 10px 0;
    }

    .calendar-days {
      height: 100%;
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 1px;
      background: #e0e0e0;
    }

    .day {
      /* aspect-ratio: 1; */
      /* height: 16%; */
      background: white;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      position: relative;
      cursor: pointer;
      transition: all 0.2s;
    }

    .day:hover {
      background: #f0f8ff;
    }

    .day-number {
      font-size: 1.2rem;
      font-weight: bold;
    }

    .day.other-month {
      color: #ccc;
      background: #f9f9f9;
    }

    .day.today {
      background: #e6f7ff;
      font-weight: bold;
    }

    .day.checked {
      background: #e8f5e9;
    }

    .day.unchecked {
      background: #ffebee;
    }

    .day.checked::after {
      content: '✓';
      position: absolute;
      bottom: 10px;
      color: #2e7d32;
      font-size: 1.5rem;
      font-weight: bold;
    }

    .day.unchecked::after {
      content: '✗';
      position: absolute;
      bottom: 10px;
      color: #c62828;
      font-size: 1.5rem;
      font-weight: bold;
    }

    .stats {
      padding: 20px;
      background: white;
      margin-top: 20px;
      border-radius: 10px;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    }

    .progress-bar {
      height: 20px;
      background: #f0f0f0;
      border-radius: 10px;
      margin-top: 10px;
      overflow: hidden;
    }

    .progress {
      height: 100%;
      background: linear-gradient(90deg, #6a11cb, #2575fc);
      transition: width 0.5s;
    }

    .legend {
      display: flex;
      justify-content: center;
      margin-top: 15px;
      gap: 20px;
    }

    .legend-item {
      display: flex;
      align-items: center;
    }

    .legend-color {
      width: 20px;
      height: 20px;
      margin-right: 5px;
      border-radius: 3px;
    }
  </style>
</head>

<body>
  <div id="app" style="display: flex;flex-direction: column; height: 100%;">
    <div class="calendar-container">
      <div class="calendar-header">
        <button @click="prevMonth">上个月</button>
        <h2>{{ currentYear }}年 {{ currentMonth + 1 }}月</h2>
        <button @click="nextMonth">下个月</button>
      </div>

      <div class="calendar-weekdays">
        <div v-for="day in weekdays" :key="day" class="weekday">{{ day }}</div>
      </div>

      <div class="calendar-days">
        <div v-for="(day, index) in calendarDays" :key="index" :class="[
            'day', 
            { 'other-month': !day.isCurrentMonth },
            { 'today': day.isToday },
            { 'checked': day.checked },
            { 'unchecked': day.isCurrentMonth && !day.isToday && !day.checked && day.date < today }
          ]" @click="toggleCheck(day.date)">
          <span class="day-number">{{ day.date.getDate() }}</span>
        </div>
      </div>
    </div>

    <div class="stats">
      <h3>{{Personal_Name}} 本月打卡统计</h3>
      <p>已打卡: {{ checkedCount }}天 / {{ currentMonthDays }}天</p>
      <div class="progress-bar">
        <div class="progress" :style="{ width: progressPercentage }"></div>
      </div>
      <div class="legend">
        <div class="legend-item">
          <div class="legend-color" style="background: #e8f5e9;"></div>
          <span>已打卡</span>
        </div>
        <div class="legend-item">
          <div class="legend-color" style="background: #ffebee;"></div>
          <span>未打卡</span>
        </div>
        <div class="legend-item">
          <div class="legend-color" style="background: #e6f7ff;"></div>
          <span>今天</span>
        </div>
        <div class="legend-item">
          <div class="legend-color" style="background: #f9f9f9;"></div>
          <span>其他月份</span>
        </div>
      </div>
    </div>
    <div style="max-width: 800px;
  margin: 0 auto;">


      <button style='border: none;
  border-radius: 12px;
  padding: 12px 25px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;' @click="goBack">返回</button>


    </div>


  </div>
</body>

</html>